<include file="public/header" title="虚拟订单" body="g4"/>
<include file="public/header_nav" title="虚拟订单" href="javascript:history.back(-1);"/>
<style>
	.mytit_flash .addset li {
		width: 25%;
	}

</style>
<div class="tit-flash-sale p mytit_flash">
	<div class="maleri30">
		<ul class="addset">
            <li <if condition="$Request.param.type eq ''">class="red"</if>>
            <a href="{:U('/Mobile/Virtual/virtual_list')}" class="tab_head">全部订单</a>
            </li>
            <li id="WAITPAY" <if condition="$Request.param.type eq 'WAITPAY'">class="red"</if>">
            <a href="{:U('/Mobile/Virtual/virtual_list',array('type'=>'WAITPAY'))}" class="tab_head" >待付款</a>
            </li>
            <li id="WAITSEND" <if condition="$Request.param.type eq 'PAYED'">class="red"</if>>
            <a href="{:U('/Mobile/Virtual/virtual_list',array('type'=>'PAYED'))}"  class="tab_head">已付款</a>
            </li>
            <li id="WAITCCOMMENT"  <if condition="$Request.param.type eq 'FINISH'">class="red"</if>>
            <a href="{:U('/Mobile/Virtual/virtual_list',array('type'=>'FINISH'))}" class="tab_head">已完成</a>
            </li>
		</ul>
	</div>
</div>

<!--订单列表-s-->
<div class="ajax_return">
	<if condition="count($order_list) eq 0">
		<!--没有内容时-s--->
		<div class="comment_con p">
			<div class="none">
				<img src="__STATIC__/images/none2.png">
				<br><br>抱歉未查到数据！
				<div class="paiton">
					<div class="maleri30">
						<a class="soon" href="{:U('Index/index')}"><span>去逛逛</span></a>
					</div>
				</div>
			</div>
		</div>
		<!--没有内容时-e--->
		<else/>
		<volist name="order_list" id="order">
			<div class="mypackeg ma-to-20 getmore">
				<div class="packeg p">
					<div class="maleri30">
						<div class="fl">
							<p class="bgnum"><span>订单编号:</span><span>{$order.order_sn}</span></p>
						</div>
						<div class="fr">
							<span>{$order['order_status_detail']}</span>
						</div>
					</div>
				</div>
				<div class="shop-mfive p">
					<div class="maleri30">
						<foreach  name="order.order_goods" item="goods">
							<div class="sc_list se_sclist paycloseto">
								<!--虚拟订单-->
								<a href="{:U('/Mobile/Virtual/virtual_order',array('order_id'=>$order['order_id']))}">
									<div class="shopimg fl">
										<img src="{$goods[goods_id]|goods_thum_images=200,200}">
									</div>
									<div class="deleshow fr">
										<div class="deletes">
											<span class="similar-product-text">{$goods[goods_name]|getSubstr=0,20}</span>
										</div>
										<div class="des-mes">
											<span class="similar-pro-text">{$goods.spec_key_name}</span>
										</div>
										<div class="prices  wiconfine">
											<p class="sc_pri"><span>￥</span><span>{$goods[member_goods_price]}</span></p>
										</div>
										<div class="qxatten  wiconfine">
											<p class="weight"><span>数量</span>&nbsp;<span>{$goods[goods_num]}</span></p>
										</div>
										<div class="buttondde">
											<if condition="$order.order_button[comment_btn] eq 1">
												<a  href="{:U('Mobile/Order/add_comment',['order_id'=>$order.order_id,'rec_id'=>$goods.rec_id])}">评价晒单</a>
											</if>
										</div>
									</div>
								</a>
							</div>
						</foreach>
					</div>
				</div>
				<div class="shop-rebuy-price p">
					<div class="maleri30">
			                <span class="price-alln">
			                    <span class="threel">共{$order.count_goods_num}件商品</span>
			                    	实付款：<span class="red">￥{$order['order_amount']}</span>
			                </span>
					</div>
				</div>
				<div class="shop-rebuy-price p">
					<div class="maleri30">
						<if condition="$order.order_button[pay_btn] eq 1">
							<a class="shop-rebuy paysoon" href="{:U('Mobile/Cart/cart4',array('order_id'=>$order.order_id))}">立即付款</a>
						</if>
						<if condition="$order.order_button[receive_btn] eq 1">
							<a class="shop-rebuy paysoon"  onclick="order_confirm({$order['order_id']})">确认收货</a>
						</if>
					</div>
				</div>
			</div>
		</volist>
	</if>
</div>
<!--订单列表-e-->
<!--加载更多-s-->
<if condition="!empty($order_list)">
	<div id="getmore"  style="font-size:.32rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both;display: none">
		<a >已显示完所有记录</a>
	</div>
</if>
<script type="text/javascript" src="__STATIC__/js/sourch_submit.js"></script>
<script type="text/javascript">

	/**
	 * 确认收货
	 * @param orderId
	 */
	function order_confirm(orderId)
	{
		if(!confirm("确定收货?"))
			return false;
		$.ajax({
			url:"{:U('Virtual/virtual_confirm')}",
			type:'POST',
			dataType:'JSON',
			data:{order_id:orderId},
			success:function(data){
				if(data.status == 1){
					layer.open({content:data.msg, time:2});
					location.href ='/index.php?m=mobile&c=Virtual&a=virtual_list&id='+orderId;
				}else{
					layer.open({content:data.msg, time:2});
					location.href ='/index.php?m=mobile&c=Virtual&a=virtual_list&type={$Request.param.type}&p={$Request.param.p}';
				}
			},
			error : function() {
				layer.open({content:'网络失败，请刷新页面后重试', time: 2});
			}
		})
	}

	/**
	 * 取消订单
	 */
	function cancel_order(id){
		if(!confirm("确定取消订单?"))
			return false;
		$.ajax({
			type: 'GET',
			url:"/index.php?m=Mobile&c=Order&a=cancel_order&id="+id,
			dataType:'JSON',
			success:function(data){
				if(data.status == 1){
					layer.open({content:data.msg,time:2});
					location.href = "/index.php?m=Mobile&c=Virtual&a=virtual_list";
				}else{
					layer.open({content:data.msg,time:2});
					return false;
				}
			},
			error:function(){
				layer.open({content:'网络失败，请刷新页面后重试',time:3});
			},
		});
	}

	var  page = 1;
	/**
	 *加载更多
	 */
	function ajax_sourch_submit()
	{
		page += 1;
		$.ajax({
			type : "GET",
			url:"/index.php?m=Mobile&c=Virtual&a=virtual_list&type={$Request.param.type}&is_ajax=1&p="+page,//+tab,
			success: function(data)
			{
				if(data == '') {
					$('#getmore').show();
					return false;
				}else{
					$(".ajax_return").append(data);
					$(".m_loading").hide();
				}
			}
		});
	}
</script>
</body>
</html>
